
from moviepy import VideoFileClip

def get_byte_range_by_time(self, file_path, start_time, end_time):
    clip = VideoFileClip(file_path)
    duration = clip.duration  # 视频总时长

    # 获取字节范围（需实际文件读取）
    with open(file_path, 'rb') as f:
        f.seek(0, 2)
        total_bytes = f.tell()

    # 简化的线性估算（实际需解析关键帧）
    start_byte = int((start_time / duration) * total_bytes)
    end_byte = int((end_time / duration) * total_bytes)

    return start_byte, end_byte
